/*
day197
2020.3.12
*/
#include<iostream>
#include<string>
#include<vector>
using namespace std;

class Solution {
public:
    vector<string> letterCasePermutation(string S) {
		vector<string> res;
		help(res,S,0);
		return res;
    }
    
    void help(vector<string> &res,string str,int point)
    {
    	if(point==str.size())
    	{
    		res.push_back(str);
    		return ;
		}
		
		if(str[point]>='A' && str[point]<='Z')
		{
			help(res,str,point+1);
			str[point]+=32;
			help(res,str,point+1);
		}
		
		else if(str[point]>='a' && str[point]<='z')
		{
			help(res,str,point+1);
			str[point]-=32;
			help(res,str,point+1);
		}
		
		else
		{
			help(res,str,point+1);
		}
	}
};

int main()
{
	Solution s;
	string S = "a1b2";
	vector<string> res=s.letterCasePermutation(S);
	for(auto &str:res)
	{
		cout<<str<<endl;
	}
	return 0;
 } 
